package com.example.programme.database;
//创建用户表
import android.annotation.SuppressLint;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.List;

public class UserDBHelper extends SQLiteOpenHelper {

    private static final int VERSION = 1;//版本号
    private static final String DB_NAME = "User.db";//库名
    public static final String TB_NAME = "tb_User";//表名


    public UserDBHelper(@Nullable Context context, @Nullable String name,
                        @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }
    public UserDBHelper(Context context) {
        super(context,DB_NAME,null,VERSION);
    }

    @Override
      public void onCreate(SQLiteDatabase db) {
        db.execSQL("CREATE TABLE "+TB_NAME+"(Id INTEGER PRIMARY KEY AUTOINCREMENT,Name TEXT,Password TEXT)");
      }

      @Override
      public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

      }

  }
